<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<script type="text/javascript" src="js/common.js"></script>
		<style>
			ul {
				color: #8f8f94;
			}
			.mui-btn {
				padding: 10px;
			}
			.my-chat{
				margin-right: 6px !important;
				font-size: 23px !important;
				padding-top: 12px !important;
			}
			.t-c{
				text-align: center;
			}
			.m-40{
				height: 40px;
				line-height: 40px;
			}
			.m-row{
				background-color: #ffffff;
				border-bottom: 1px solid #EEEEEE;
				margin-bottom: 10px;
			}
			.m-b-f{
				background-color: #ffffff !important;
				border: none !important;
				margin-bottom: 10px !important;
				border-bottom: 1px solid #EEEEEE;
			}
			.m-b-f li{
				border: none !important;
			}
			.m-padding{
				padding-top: 11px;
			}
			.m-badge{
				padding: 7px;
				background-color: #08c5bf;
				width:80%;
			}
			.m-t-left{
				text-align: left;
			}
			.m-t-right{
				text-align: right;
			}
			.m-hr{
				background: #08c5bf;
				height: 1px;
				border: none;
			}
			.m-btn{
				height: 50px !important;
				top: 0px !important;
				border-radius: 0px !important;
				background-color: #D9B279;
				border-color: #D9B279;
			}
			.m-b-top{
				margin-top: 30px;	
			}
			.m-b-top button{
				height: 100px;
				background-color: #08c5bf;
				border: none;
			}
			.mui-media-body{
				font-size: 12px !important;
			}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav" style="padding-right: 15px;">
			<a class="mui-icon mui-icon-home mui-icon-left-nav mui-pull-left"></a>
			<a class="mui-icon mui-icon-gear mui-pull-right" id="userInfo"></a>
			<a class="mui-icon mui-icon-chat mui-pull-right my-chat"></a>
		</header>
		<div class="mui-content">
			<div class="mui-row t-c font-13 m-row">
				<div class="mui-col-sm-4 mui-col-xs-4 m-padding">
		            <span class="mui-badge mui-badge-success m-badge">
		            	今日销售额
		           	</span>
		        </div>
		        <div class="mui-col-sm-4 mui-col-xs-4 m-padding">
		            <span class="mui-badge mui-badge-success m-badge">
		            	本月销售额
		            </span>       	
		        </div>
		        <div class="mui-col-sm-4 mui-col-xs-4 m-padding">
		           	<span class="mui-badge mui-badge-success m-badge">
		           		账户余额
		           	</span>
		        </div>
		        <div class="mui-col-sm-4 mui-col-xs-4">
		            <div class="mui-table-view-cell">
		               1868.00
		            </div>
		        </div>
		        <div class="mui-col-sm-4 mui-col-xs-4">
		            <div class="mui-table-view-cell">
		                890.90
		            </div>
		        </div>
		        <div class="mui-col-sm-4 mui-col-xs-4">
		            <div class="mui-table-view-cell">
		                900.00
		            </div>
		        </div>
			</div>
			<ul class="mui-table-view mui-grid-view mui-grid-9 m-b-f">
				<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
				    <a href="#">
				        <img src="images/user.png" style="height: 42px;"/>
				        <div class="mui-media-body">会员管理</div>
				    </a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"  id="shoppingManage">
				    <a href="#">
				        <img src="images/shopping.png" style="height: 42px;"/>
				        <div class="mui-media-body">商品管理</div>
				    </a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
				    <a href="#">
				         <img src="images/order.png" style="height: 42px;"/>
				        <div class="mui-media-body">订单管理</div>
				    </a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
				    <a href="#">
				         <img src="images/num.png" style="height: 42px;"/>
				        <div class="mui-media-body">经营数据</div>
				    </a>
				</li>
				<li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
				    <a href="#">
				        <img src="images/cardManage.png" style="height: 42px;"/>
				        <div class="mui-media-body">卡管理</div>
				    </a>
				</li>
			</ul>
		
			<div class="mui-row t-c font-13 m-40">
				<div class="mui-col-sm-4 mui-col-xs-4 m-padding">
					<hr class="m-hr"/>
		        </div>
		        <div class="mui-col-sm-4 mui-col-xs-4">
		                               订单结账
		        </div>
		        <div class="mui-col-sm-4 mui-col-xs-4 m-padding">
					<hr class="m-hr"/>
		        </div>
			</div>
			<div class="mui-row t-c font-13 m-40 m-b-top">
				<div class="mui-col-sm-1 mui-col-xs-1">
				</div>
				<div class="mui-col-sm-4 mui-col-xs-4">
					<button type="button"  class="mui-btn mui-btn-blue mui-btn-block" id="Barcode.html" onclick="clicked(this.id)">扫码购物</button>
		        </div>
		        <div class="mui-col-sm-2 mui-col-xs-2">
				</div>
		        <div class="mui-col-sm-4 mui-col-xs-4">
		            <button type="button" id="freeGoods" class="mui-btn mui-btn-blue mui-btn-block">自选商品</button>                  
		        </div>
		        <div class="mui-col-sm-1 mui-col-xs-1">
				</div>
			</div>
		</div>
		<nav class="mui-bar mui-bar-tab">
		    <button type="button" class="mui-btn mui-btn-blue mui-btn-block m-btn mui-icon mui-icon-home mui-text-center">按钮</button>
		</nav>
		<script src="../js/mui.min.js"></script>
		<script src="js/public.js"></script>
		<script src="js/app.js"></script>
		<script>
			(function($, doc) {
				$.init({
					beforeback: function(){
						//获得列表界面的webview
						var list = plus.webview.getWebviewById('login');
						//触发列表界面的自定义事件（refresh）,从而进行数据刷新
						mui.fire(list,'refreshHtml');
						//返回true，继续页面关闭逻辑
						return true;
					}
				});
				var settings = app.getSettings();
				var account = doc.getElementById('account');
				window.addEventListener('refreshHtml', function(e) {  
		            location.reload();  
		        }) 
				//
				window.addEventListener('show', function() {
					var state = app.getState();
					 //account.innerText = state.account;
				}, false);
				$.plusReady(function() {
					 document.getElementById("userInfo").addEventListener("tap", function() {
					 	mui.openWindow({
		                    url: "userInfo.html",
		                    id: "userInfo"
		                });
					 })
					document.getElementById("shoppingManage").addEventListener("tap", function() {
						mui.openWindow({
							url: "shoppingManage.html",
							id: "shoppingManage"
						});
					});
					 document.getElementById("freeGoods").addEventListener("tap", function() {
                    /**
                     * 向本地存储中设置launchFlag的值，即启动标识；
                     * http://www.html5plus.org/doc/zh_cn/storage.html#plus.storage.setItem
                     */
                    plus.storage.setItem("freeGoods", "true");
                   	mui.prompt('请输入会员手机号码','手机号','会员信息',['取消','确定'],function(e){
							if(e.index==1){
								var verification = myPublic.verification(e.value);
								if(!verification){	
									mui.toast('请输入正确的手机号!',{ duration:'long', type:'div' });
								}else{
									mui.ajax({
										headers: {
											"device-udid":headers.device_udid,
										    "device-client":headers.device_client,
										    "device-code":headers.device_code,
										    "api-version":headers.api_version,
										},
										type:'POST',
										url: publicUrl +"/sites/api/?url=user/signin",
										dataType:"json",
										async: true,
										data:{
											"name":e.value,
										},
										success:function(data){
											//console.log(JSON.stringify(data.status.succeed));
											if(data.status.succeed == 1){
												localStorage.setItem("telMember",data.data.user.id);
												mui.openWindow({
								                    url: "goods.html",
								                    id: "goods"
								              	});
											}else{
												mui.toast('会员号码不正确!',{ duration:'long', type:'div' });
												
											}
										}
									})
								}
								return false;
							}  
							else {
								localStorage.setItem("telMember","2");
								mui.openWindow({
				                    url: "goods.html",
				                    id: "goods"
				                });
							}
					 	},'div')
				  	 	document.querySelector('.mui-popup-input input').type='tel'
                	});
				});
			}(mui, document));
		</script>
	</body>

</html>